<?php

namespace App\Models;



class CzProduct extends ApiBaseModel
{

    protected $table = 'cz_product';
    protected $fillable = [
        'title',
        'type',
        'hf_type',
        'isp',
        'status',
        'area_path',
        'area_name',
        'province_id',
        'city_id',
        'create_by',
        'update_by',
        'stop_fail',
        'timeout',
        'is_split'
    ];
    protected $casts = [
        'type' => 'string',
        'hf_type' => 'string',
        'isp' => 'string',
        'status' => 'string',
        'is_split' => 'string',
    ];

    public function specs()
    {
        return $this->hasMany(CzSpec::class, 'product_id', 'id');
    }
    public function province()
    {
        return $this->belongsTo(Areas::class, 'province_id', 'id');
    }
    public function city()
    {
        return $this->belongsTo(Areas::class, 'city_id', 'id');
    }
    // 产品限充
    public function productLimit()
    {
        return $this->hasOne(ProductLimit::class, 'product_id', 'id');
    }
}
